Why is that when I run this script do I get the error "cannot import name requests"
I have already run "pip install requests"
from bzrlib import branch,requests, json
def x:
url = myURL
data = json.dumps({"one": "two"})
r = requests.post(url, data)
print r.json
You are trying to import bzrlib.requests
, not the top-level package requests
. The same applies to json
here.
Move the imports to separate lines :
from bzrlib import branch
import requests
import json
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.