Code Monkey home page Code Monkey logo

requests-cloudkit's Issues

Close a credentials stream

The warning appears during requests when doing unit tests via unittest package:

/venv/lib/python3.7/site-packages/requests_cloudkit/cloudkit.py:78:
ResourceWarning: unclosed file <_io.TextIOWrapper name='credentials/CloudKitKeyDev.pem' mode='r' encoding='UTF-8'>
  return open(self.key_file_name).read()
ResourceWarning: Enable tracemalloc to get the object allocation traceback

Strings must be encoded before hashing

I keep getting Strings must be encoded before hashing when I try to do r = cloudkit.POST.public.records.modify(j)

This is a problem only on Windows. On Mac, everything works.

Doesn't install under Python 3.6.0

Hi, I couldn't get requests-cloudkit to install under Python 3.

$ pip3 install requests-cloudkit
Collecting requests-cloudkit
  Using cached requests-cloudkit-0.1.5.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/private/var/folders/v3/7yxzprtn5cs4rjy2yj5lf67c0000gn/T/pip-build-zpmhjvdq/requests-cloudkit/setup.py", line 15, in <module>
        execfile("requests_cloudkit/metadata.py", metadata)
    NameError: name 'execfile' is not defined
    
    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/v3/7yxzprtn5cs4rjy2yj5lf67c0000gn/T/pip-build-zpmhjvdq/requests-cloudkit/

Well execfile doesn't exist in Python 3, but are there other things that would stop the requests-cloudkit from being installed?

TypeError on simple request

After the most basic setup, as included in the README.md:

>>> import requests
>>> from requests_cloudkit import CloudKitAuth
>>> auth = CloudKitAuth(key_id=YOUR_KEY_ID, key_file_name=YOUR_PRIVATE_KEY_PATH)
>>> requests.get("https://api.apple-cloudkit.com/database/[version]/[container]/[environment]/public/zones/list", auth=auth)

I am getting the following error:

File "/opt/anaconda3/[...]/lib/python3.7/site-packages/requests_cloudkit/cloudkit.py", line 45, in make_signature
signature = "{}:{}:{}".format(formatted_date, self.encode_body(body), path)
File "/opt/anaconda3/[...]/lib/python3.7/site-packages/requests_cloudkit/cloudkit.py", line 62, in encode_body
h = hashlib.sha256(body)
TypeError: Unicode-objects must be encoded before hashing

I have tried encoding the body variable within the encode_body() method, but that did not change anything. I have also tried multiple key files and multiple containers, still no change (All of these work normally with CloudKitJS or my custom Java wrapper).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.