...
âshîsh
Your welcome.
Poojitha
anyone know how to host django website without venv?
Michael
Mirco
Mirco
Michael
def verify_payment(self, ref, *args, **kwargs):
path = f'transaction/verify{ref}'
headers = {
'Authorization': f"Bearer {self.PAYSTACK_SECRET_KEY}",
'content-type': 'application/json'
}
url = self.base_url + path
response = requests.get(url, headers=headers)
if response.status_code == 200:
response_data = response.json()
return response_data['status'], response_data['data']
response_data = response.json()
return response_data["status"], response_data["message"]
This is my code here
Mirco
Michael
Mirco
I bet my 2 cents the url is /verify/<ref> following REST
hence you receive the Connection Error due to wrong URL pattern
Mirco
and self.base_path + url can be converted to an f-string as well
f"{self.base_path}{url}"
Michael
I appreciate your efforts man
But it's still not working
Michael
ConnectionError at /verify/Kss45FotAtdjLAthoDzKeFme-YYoQAd_h0Jcc4sqf9NEpJaXmjMyaXAK-xx2RBpiqow/
HTTPSConnectionPool(host='api.paystack.cotransaction', port=443): Max retries exceeded with url:
Mirco
Mirco
curl https://api.paystack.co/transaction/verify/:reference
-H "Authorization: Bearer YOUR_SECRET_KEY"
-X GET
from Paystack API docs
your URL -> https://api.paystack.cotransaction/veryfy/{ref}
as u can see you miss a / between .co and transaction
Marcos
the url is wrong
Marcos
should be:
https://api.paystack.co/transaction
and you have:
https://api.paystack.cotransaction
Mirco
based on your code, just change
path = f'transaction/verify{ref}' to path = f'/transaction/verify/{ref}'
and it will work
Mirco
Marcos
ammm i think this is not a documentation error as he went through all the other details correctly but a silly typo error and mihael was confused because requests didn't told him that the URL was wrong, however requests does not guess which server are you trying to onnect to it only tries to connect but not able due to the typo and says connectionerror
Mirco
Marcos
totally agree with you man, i guess michael will be starting using
https://docs.python.org/3.7/library/urllib.parse.html
since today, otherwise he did not learn anything from today
Michael
Marcos
Shanmukh
Hello,
Why does
From django.contrib.auth
logout(request)
Doesn't work ??
After running this still the user(used user model) doesn't get logout??
Thanks in Advance
William
Shanmukh
Michael
JSONDecodeError at /3dMMlXI9v1r-VKlfaqfNc3P44jC560mZr1SZFbczSmG6pjqT9451P5Ob0f3THCVkEPY/
Expecting value: line 1 column 1 (char 0)
Any idea on what's going on
Suleman
Hey Guyz.
Does anybody get a chance to integrate bitpay with django.
I got some issues related to it
Suleman
can anybody please help me out in this
Suleman
i need some guide to integrate through this
Suleman
thanks
ADI
Reverse for 'edit_movies' with arguments '('',)' not found. 1 pattern(s) tried: ['edit/(?P<id>[0-9]+)/$'] i am facing this error any one tell
Mirco
Marcos
GOPINATH
Can anyone help me with postman token authentication
GOPINATH
I am facing issues in connecting that
Ash
GOPINATH
I have provided the bearer token
GOPINATH
But still it shows unauthorised 401
GOPINATH
But I can able to connect through httpie with that token
GOPINATH
That token is created for superuser
Ash
Is the token a jwt token
GOPINATH
No
Riswandi
but I don't like it
Shruti
I am create a profile is shows default data but not show in take extra field data after sign up like city mobile and state can you help
pat
My celery can't run models from tasks.py.. Do I need signals to manipulate models in tasks.py with celery?? Halp
pat
I'm having headaches for 3days guys.. Pls
pat
My question is : how to pass models in tasks.py?
B
Good day, please I'd like to ask if anyone can send resources for Django and using websocket. Thanks
Anonymous
pat
Suleman
Hey Guyz.
Does anybody get a chance to integrate bitpay with django.
I got some issues related to it
can anybody please help me out in this
i need some guide to integrate through this
Marcos
first instead of response.status_code you should use:
if response.ok
requests library behind the scene checks for diferent status codes like 200, 201, etc
now the error here is that what you are receiving in response is not well formated as json you should check what
response.content
contains, it contains the raw response of the webserver, response.json() parses response.content into a python dict object
Ashu
Looking for freelancer on python & Django..pls ping me separately if anyone interested..
Michael
Marcos
have you already checked what does the webserver is responding to you as i said above?
what does response.content "contains"
if response.content has the following => b'{"this_is_the key": "this is the value"}'
requests library will be able to parse it successfuly and will return to you in response.json() the following => {'this_is_the_key': 'this is the value'}
on the other hand if response.content 'contains' the following => b'this is another response bla bla bla'
requests library will not be able to parse it as json is like you are trying to perform this:
import json
json.loads('bla bla')
it will raise
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
Michael
Marcos
Ok
Marcos
Doragonsureiyā
Editing Name
Hello
Poojitha
Can anyone tell me how to resolve this error (2002, "Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)") in windows
VISHNU
In generic relationship in that content type field in admin panel can I able to restrict to show 2 models in drop-down which i need there are many model in that model so I need to show only 2 models can any one help me on this.
@𝑺𝒐𝒃𝒌𝒂
Hi guys. I'm novice in Django. I'm creating an admin user but when the command line prompts to the password, it doesn't accept any character.
What should be a problem?
âshîsh
@𝑺𝒐𝒃𝒌𝒂
@𝑺𝒐𝒃𝒌𝒂
Thank you!!
âshîsh
Mention not
A
Can I use grapesjs works with django?
Hari
Anonymous
How to build django in Blog application